﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentData;
using Huazhu.PMS.Framework.Data;

namespace Huazhu.PMS.Framework.Core
{
    internal class RuleRolesDataAccess:BaseDataAccess
    {
        internal List<RuleRoles> GetRuleRoles()
        {
            var sql = "SELECT [dbo].[Rule_Roles].[sRuleID], [dbo].[Rule_Roles].[sExpression] FROM [dbo].[Rule_Roles]";

            using (var context = DataHelper.GetBaseDbContext())
            {
                var rulePages =
                    context.Sql(sql).QueryMany<RuleRoles>(delegate(RuleRoles map, IDataReader reader)
                    {
                        map.RuleID = reader.GetString("sRuleID");
                        map.Expression = reader.GetString("sExpression");
                        //TODO:更多字段
                    });
                return rulePages;
            }
        }
    }
}
